/*hello_module.c*/
#include<linux/init.h>
#include<linux/time.h>
#include<linux/wait.h>
#include<linux/kernel.h>

#include<linux/jiffies.h>
//#include<linux/type.h>
#include<linux/module.h>
#include<linux/device.h>
#include <linux/sched.h>
MODULE_LICENSE("GPL");

#define SERIAL_IMX_MAJOR        207
#define MINOR_START	        16
#define DEV_NAME		"helloworld"

static int hello_init(void)
{
	unsigned long  jif_tmp;
	wait_queue_head_t wait;
//	register_chrdev_region();
	init_waitqueue_head(&wait);
	printk(KERN_EMERG "Hello Linux Driver!%d\n",HZ);
	wait_event_interruptible_timeout(wait,0,5*HZ);
	printk(KERN_EMERG "delay_5\n");
	//wait_event_interruptible_timeout
	jif_tmp=jiffies;	
	jif_tmp+=5*HZ;
	while(time_before(jiffies,jif_tmp))
		cpu_relax();

	printk(KERN_EMERG "delay_10\n");
	return 0;
}

static void hello_exit(void)

{
	printk(KERN_EMERG "Hello Diver Exit !\n");
}
module_init(hello_init);
module_exit(hello_exit);
